package UILayer;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;

import java.awt.GridLayout;

import javax.swing.border.LineBorder;

import java.awt.Color;

import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import javax.swing.JLabel;
import javax.swing.JCheckBox;
import javax.swing.JOptionPane;
import javax.swing.JTextPane;
import javax.swing.JTextArea;
import javax.swing.table.DefaultTableModel;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class StartScreen extends JFrame {

	private JPanel contentPane;
	private JPanel panel;
	private JPanel panel_1;
	private JButton btnSale;
	private JButton btnLagerstyring;
	private JButton btnVarerhndtering;
	private JButton btnLogUd;
	private JButton btnProduktgruppeHndtering;

	private KundeSalgPanel ksp;
	private VarePanel vp;
	private KundePanel kp;
	private ProduktgruppePanel pgp;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					StartScreen frame = new StartScreen();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public StartScreen() {
		ksp = new KundeSalgPanel();
		vp = new VarePanel();
		kp = new KundePanel();
		pgp = new ProduktgruppePanel();

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 926, 552);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);

		JPanel panel = new JPanel();
		panel.setBounds(10, 11, 227, 387);
		contentPane.add(panel);
		panel.setLayout(null);

		btnSale = new JButton("Salg");
		btnSale.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				openSale();
			}
		});
		btnSale.setBounds(10, 23, 199, 29);
		panel.add(btnSale);

		btnLagerstyring = new JButton("Kundeh\u00E5ndtering");
		btnLagerstyring.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				openCustomer();
			}
		});
		btnLagerstyring.setBounds(10, 75, 199, 29);
		panel.add(btnLagerstyring);

		btnVarerhndtering = new JButton("Varerh\u00E5ndtering");
		btnVarerhndtering.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				openProductManagement();
			}
		});
		btnVarerhndtering.setBounds(10, 130, 199, 29);
		panel.add(btnVarerhndtering);

		btnLogUd = new JButton("Log ud");
		btnLogUd.setBounds(10, 347, 81, 29);
		panel.add(btnLogUd);

		btnProduktgruppeHndtering = new JButton("Produktgruppe h\u00E5ndtering");
		btnProduktgruppeHndtering.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				openProductGroupManagement();
			}
		});
		btnProduktgruppeHndtering.setBounds(10, 179, 199, 29);
		panel.add(btnProduktgruppeHndtering);
	}

	private void openSale() {
		this.panel_1 = this.ksp;	
		contentPane.add(panel_1);
		this.panel_1.setBounds(247, 11, 653, 491);	
	}

	private void openCustomer() {
		this.panel_1 = this.kp;
		contentPane.add(panel_1);
		this.panel_1.setBounds(247, 11, 653, 491);	
	}

	private void openProductManagement() {
		this.panel_1 = this.vp;
		contentPane.add(panel_1);
		this.panel_1.setBounds(247, 11, 653, 491);	
	}

	private void openProductGroupManagement() {
		this.panel_1 = this.pgp;			
		contentPane.add(panel_1);
		this.panel_1.setBounds(247, 11, 653, 491);
	}
}
